/*
 * Copyright (c) 2005, 2020, Jin Lin All rights reserved.
 * Jin Lin PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 */
package aco.entity.dobject;

import java.util.ArrayList;
import java.util.List;

/**
 * 描述 蚁群.
 *
 * @author Jin Lin
 * @created 2019 -06-30 13:25:49
 */
public class Colony {

    /**
     * 蚂蚁列表.
     */
    private List<Ant> ants;

    /**
     * 变异蚂蚁临界值.
     */
    private Long criticalPoint;

    /**
     * 描述 初始化蚂蚁对象.
     *
     * @param antNum           the ant num
     * @param increaseRatio    the increase ratio
     * @param attenuationRatio the attenuation ratio
     * @param cost             代价对象赋值，利用代价对象中的Tasks数组
     * @author Jin Lin
     * @created 2019 -07-01 22:37:13 Init ants.
     */
    public void initAnts(Long antNum, Double increaseRatio, Double attenuationRatio, Cost cost) {
        List<Ant> ants = new ArrayList<>();
        for (Long i = 0L; i < antNum; i++) {
            Ant ant = new Ant();
            ant.setPath(cost.getTasks());
            ant.setIncreaseRatio(increaseRatio);
            ant.setAttenuationRatio(attenuationRatio);
            ants.add(ant);
        }
        setAnts(ants);
    }


    //=========================================================================


    /**
     * Instantiates a new Colony.
     */
    public Colony() {
    }

    /**
     * Instantiates a new Colony.
     *
     * @param ants          the ants
     * @param criticalPoint the critical point
     */
    public Colony(List<Ant> ants, Long criticalPoint) {
        this.ants = ants;
        this.criticalPoint = criticalPoint;
    }

    /**
     * 描述 Gets ants.
     *
     * @return the ants
     * @author Jin Lin
     * @created 2019 -07-01 22:05:07
     */
    public List<Ant> getAnts() {
        return ants;
    }

    /**
     * 描述 Sets ants.
     *
     * @param ants the ants
     * @author Jin Lin
     * @created 2019 -07-01 22:05:07
     */
    public void setAnts(List<Ant> ants) {
        this.ants = ants;
    }

    /**
     * 描述 Gets critical point.
     *
     * @return the critical point
     * @author Jin Lin
     * @created 2019 -07-01 22:05:07
     */
    public Long getCriticalPoint() {
        return criticalPoint;
    }

    /**
     * 描述 Sets critical point.
     *
     * @param criticalPoint the critical point
     * @author Jin Lin
     * @created 2019 -07-01 22:05:07
     */
    public void setCriticalPoint(Long criticalPoint) {
        this.criticalPoint = criticalPoint;
    }
}
